//使用函数求最大值：
import java.util.Scanner;
public class TestDemo {
    public static int max2(int x,int y){
        if(x > y){
            return x;
        }else{
            return y;
        }
    }

    public static int max3(int x,int y, int z) {
        int g = max2(x,y);
        if(g > z){
            return g;
        }else{
            return z;
        }
    }
    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int a = sc.nextInt();
        System.out.println(max3(n,m,a));
        sc.close();
    }
    //N的阶乘（递归）
    public static int func (int N) {
        if(N == 1 || N == 0){
            return 1;
        }
        return N * func(N-1);

    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        System.out.println(func(n));
    }

    //N的阶乘和
    public static int funcSum (int N){
        if( N== 0){
            return 1;
        }
        int ret = 1;
        int sum = 0;
        for(int i = 1;i <= N; i++){
            ret *= i;
            sum += ret;
        }
        return  sum;
    }
    public static void main3(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        System.out.println(funcSum(n));
    }
    //求斐波那契数列的第n项。(迭代实现)
    public static int fibonacci(int N){
        if(N == 0){
            return 0;
        }else if(N == 2 || N == 1){
            return 1;
        }else{
            int a = 1;
            int b = 1;
            int c = 0;
            while(N > 2)
            {
                c = a + b;
                a = b;
                b = c;
                N--;
            }
            return c;
        }
    }

    public static void main4(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        System.out.println(fibonacci(n));
    }

    public static int sum (int x, int y){
        return x + y;
    }
    public static double sum (double x, double y,double z){
        return x + y + z;
    }
    public static void main5(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        System.out.println(sum(n,m));
        double a = sc.nextDouble();
        double b = sc.nextDouble();
        double c = sc.nextDouble();
        System.out.println(sum(a,b,c));
    }

    //求最大值方法的重载

    // 求两个整数的最大值
    public static int maxValue(int a, int b) {
        return Math.max(a, b);
    }
    // 求三个双精度浮点数的最大值
    public static double maxValue(double a, double b, double c) {
        double max = a;
        if (b > max) {
            max = b;
        }
        if (c > max) {
            max = c;
        }
        return max;
    }
    // 主方法用于测试
    public static void main6(String[] args) {
        System.out.println("两个整数的最大值：");
        System.out.println(maxValue(3, 5)); // 输出5
        System.out.println(maxValue(-2, -1)); // 输出-1
        System.out.println("\n三个双精度数的最大值：");
        System.out.println(maxValue(1.5, 2.3, 0.7)); // 输出2.3
        System.out.println(maxValue(-3.1, -4.5, -2.9)); // 输出-2.9
    }

    //N的阶乘(循环)
    public static void main7(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ret = 1;
        for (int i = 1; i <= n; i++) {
            ret *= i;
        }
        System.out.println(ret);
    }


}


